package com.qsmx.core.net;

import com.alibaba.fastjson.JSONObject;
import com.qsmx.core.net.callback.IError;
import com.qsmx.core.net.callback.IFailure;
import com.qsmx.core.net.callback.ISuccess;
import com.qsmx.core.util.log.AtmosLogger;

import java.util.WeakHashMap;

public class HttpHelper {

    public static void RestClientPostRaw(JSONObject json, String url, ISuccess success, IError error, IFailure failure) {
        BaseRequestWrapper params = new BaseRequestWrapper(json);
        AtmosLogger.e("url", url);
        RestClient
                .builder()
//                .loader(context)
                .url(url)
                .raw(params.aesJson().toJSONString())
                .success(success)
                .failure(failure)
                .error(error)
                .build()
                .post();
    }

    public static void RestClientGet(String url, ISuccess success, IError error, IFailure failure) {
        RestClient
                .builder()
                .url(url)
                .success(success)
                .failure(failure)
                .error(error)
                .build()
                .get();
    }
}
